package cc.web.vaaking.services;

import cc.web.vaaking.common.DB.SuperSessionFactory;
import cc.web.vaaking.entity.SysAppLog;
import cc.web.vaaking.entity.SysRole;
import cc.web.vaaking.mapper.SysAppLogMapper;
import cc.web.vaaking.mapper.SysRoleMapper;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class SysAppLogService {
    public int insertOne(SysAppLog sysAppLog){
        try (SqlSession session = SuperSessionFactory.sqlSessionFactory.openSession(true)) {
            SysAppLogMapper sysAppLogMapper = session.getMapper(SysAppLogMapper.class);
            return sysAppLogMapper.insert(sysAppLog);
        }
    }

    public List<SysAppLog> selectAllByUserId(int userId){
        try (SqlSession session = SuperSessionFactory.sqlSessionFactory.openSession()) {
            SysAppLogMapper sysAppLogMapper = session.getMapper(SysAppLogMapper.class);
            return sysAppLogMapper.selectAllByUserId(userId);
        }
    }

}
